package com.nikkerball.unit;

import com.nikkerball.interpreter.BasicInterpreter;
import com.nikkerball.interpreter.Interpreter;

import java.math.BigDecimal;

import static com.nikkerball.unit.MathHelper.powerOfTen;

/**
 * User: Marius
 * Date: 15-Feb-2010
 * Time: 19:34:33
 */
@SuppressWarnings({"MagicNumber"})
public enum ThousandsUnit implements Unit {

    single("com.nikkerball.unit.single", "", 1),
    kilo("com.nikkerball.unit.kilo", "k", powerOfTen(3)),
    mega("com.nikkerball.unit.mega", "M", powerOfTen(6)),
    giga("com.nikkerball.unit.giga", "G", powerOfTen(9)),
    tera("com.nikkerball.unit.tera", "T", powerOfTen(12)),
    peta("com.nikkerball.unit.peta", "P", powerOfTen(15)),
    exa("com.nikkerball.unit.exa", "E", powerOfTen(18));

    private String name;

    private String symbol;

    private BigDecimal conversion;

    ThousandsUnit(String name, String symbol, double conversion) {
        this.name = name;
        this.symbol = symbol;
        this.conversion = new BigDecimal(conversion);
    }

    public Unit getBaseUnit() {
        return single;
    }

    public String getKey() {
        return name;
    }

    public String getSymbol() {
        return symbol;
    }

    public Legend getConversionLegend() {
        return Legend.exactly;
    }

    public BigDecimal getConversion() {
        return conversion;
    }

    public Interpreter getInterpreter() {
        return new BasicInterpreter();
    }

}
